package com.smartstate.EnvironmentMonitor.util;

import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.List;
import java.util.Map;
import java.util.Set;


@Slf4j
@Component("TestAlarm")
public class PowerEquipmentJob {


    @Autowired
    StringRedisTemplate stringRedisTemplate;

    protected final Logger logger = LoggerFactory.getLogger(this.getClass());

    public List times(String param) {
        //根据设备ID获取所有的属性 {DHU001.humidity=30, DHU001.power=20, DHU001.desk=30}
        //param可以在新增定时任务的时候设置成设备id
        Map<Object, Object> entries = stringRedisTemplate.opsForHash().entries(param);
        //获取所有的属性名
        System.err.println(stringRedisTemplate.keys("*"));
        Set<Object> keySet = entries.keySet();
        System.err.println("所有的属性名" + keySet);

        return null;
    }
}
